package cn.chengpengper.rpc.test.spring.boot.consumer;

import cn.chengpengper.rpc.test.spring.boot.consumer.service.ConsumerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * @author huchengpeng
 */
@Slf4j
@SpringBootApplication
@ComponentScan(basePackages = {"cn.chengpengper.rpc"})
public class SpringBootConsumerDemoStarter {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(SpringBootConsumerDemoStarter.class, args);
        ConsumerService service = context.getBean(ConsumerService.class);
        String result = service.hello("hello");
        log.info("返回的数据为1：{}", result);
        result = service.hello("hello");
        log.info("返回的数据为2：{}", result);
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
        }
        result = service.hello("hello");
        log.info("返回的数据为3：{}", result);
    }
}
